#coding=utf-8
from django.db import models
from resource.models import *

# Create your models here.
     
class Item(models.Model):
    title           = models.CharField('标题', max_length = 128, blank = False)
    feed            = models.ForeignKey(Feed, verbose_name = '种子')
    url             = models.URLField('永久链接', max_length = 512, blank = False)
    description     = models.TextField('描述', default = "", unique = False)
    publishDate     = models.DateTimeField('发布时间')
    updateDate      = models.DateTimeField('更新时间', auto_now = True)
    snapshot        = models.TextField('快照', default = "")
    
    class Meta:
        get_latest_by           = "publishDate"
        verbose_name_plural 	= '条目'
        ordering 		        = ['-publishDate']
  
    def get_absolute_url(self):
        return "/i/%i/" % self.id

    def __unicode__(self):
        return '%s' % (self.title)	
